<?php

namespace App\Models\Operation;

use Eloquent as Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * Class Topbar
 * @package App\Models\Operation
 * @version June 28, 2018, 11:42 am CST
 *
 * @property string name
 * @property string title
 * @property string description
 * @property string ui
 * @property string css
 */
class Topbar extends Model
{
    use SoftDeletes;

    public $table = 'topbars';

    protected $dates = ['deleted_at'];

    public $fillable = [
        'name',
        'title',
        'description',
        'ui',
        'css',
    ];

    /**
     * The attributes that should be casted to native types.
     *
     * @var array
     */
    protected $casts = [
        'name'        => 'string',
        'title'       => 'string',
        'description' => 'string',
        'ui'          => 'string',
        'css'         => 'string',
    ];

    /**
     * Validation rules
     *
     * @var array
     */
    public static $rules = [
        'css' => 'max:50',
    ];

    public function topbararea()
    {
        return $this->hasMany(\App\Models\Operation\TopbarArea::class, 'topbar_id', 'id');
    }
}
